﻿using System;
using System.Collections.Generic;
using System.Text;
using SmallERP.MODEL.FoundationModel;
using System.Linq;

namespace SmallERP.MODEL.FenPian
{
    /// <summary>
    /// 实体类OrderInfo
    /// </summary>
    public class OrderView
    {
        #region 私有字段
        private int _orderProductId;
        private string _orderName;
        private DateTime _startTime;
        private DateTime _completeTime;
        private int _status;
        private string _orderPath;
        private string _remark;
        private int _productNum;
        private int _priority;
        private int _sameFlagOrderId;
       
        
        public List<PhotoView> PhotoS { get; set; }//相应的照片信息 
        public int PhotoCount
        {
            get
            {
                if (PhotoS != null)
                    return PhotoS.Count;
                else
                {
                    return 0;
                }
            }
        }
        public List<PaperFace_Info> AllFace { get; set; }
        public List<PaperType_Info> AllType { get; set; }
        public List<Printer_info> AllPrint { get; set; }

        public PaperFace_Info PaperFace { get; set; }

        public PaperType_Info PaperTypeInfo { get; set; }

        public Printer_info PrintInfo { get; set; }
        private string _printName;
        public string PrintName
        {
            get { return PrintInfo.PName; }
            set
            {
                _printName = value;
                PrintInfo = AllPrint.FirstOrDefault(p => p.PName == value);
            }
        }

        private string _paperFaceName;
        public string PaperFaceName
        {
            get { return PaperFace.PaperFaceName; }
            set
            {
                _paperFaceName = value;
                PaperFace=AllFace.FirstOrDefault(p => p.PaperFaceName == value);
            }
        }

        private string _paperTypeName;
        public string PaperTypeName
        {
            get { return PaperTypeInfo.PaperTypeName; }
            set
            {
                _paperTypeName = value;
                PaperTypeInfo = AllType.FirstOrDefault(p => p.PaperTypeName == value);
            }
        }
        public string OrilOrderPath
        { get; set; }

        public string MoveStatus{ get; set;}
        public int DPI { get
        {
            if(PhotoS.GroupBy(p=>p.DPI).Count()>1)
            {
                return 0;
            }
            else
            {
                return PhotoS.FirstOrDefault().DPI;
            }
        }
        }
        #endregion

        #region 公开属性
        public int OrderProductId
        {
            get { return _orderProductId; }
            set { _orderProductId = value; }
        }
        public string OrderName
        {
            get { return _orderName; }
            set { _orderName = value; }
        }
        public DateTime StartTime
        {
            get { return _startTime; }
            set { _startTime = value; }
        }
        public DateTime CompleteTime
        {
            get { return _completeTime; }
            set { _completeTime = value; }
        }
        public int Status
        {
            get { return _status; }
            set { _status = value; }
        }
        public string OrderPath
        {
            get { return _orderPath; }
            set { _orderPath = value; }
        }
        public string Remark
        {
            get { return _remark; }
            set { _remark = value; }
        }
        public int ProductNum
        {
            get { return _productNum; }
            set { _productNum = value; }
        }
        public int Priority
        {
            get { return _priority; }
            set { _priority = value; }
        }
        public int SameFlagOrderId
        {
            get { return _sameFlagOrderId; }
            set { _sameFlagOrderId = value; }
        }
        #endregion
    }
}
